package com.kerbores.template.listener;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class OnlineUserCounter implements HttpSessionListener {
	private static int count = 0;

	@Override
	public void sessionCreated(HttpSessionEvent se) {
		count ++;
		System.out.println(count);
		se.getSession().setAttribute("count_", count);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent se) {
		count --;
		se.getSession().setAttribute("count_", count);
	}
	
	public static int getCount() {
		return count;
	}

}
